import { defineComponent, reactive } from "vue";

import { getTimeGap } from "qqlx-cdk";

/** 系统已经稳定运行了...多久时间 */
export const HomeSlogan = defineComponent({
  setup() {
    const timer = reactive({ value: -1, label: "..." });
    const _from = new Date("2021/01/01 00:00").getTime();
    if (timer.value > 0) clearInterval(timer.value);
    timer.value = setInterval(() => (timer.label = getTimeGap(Date.now(), _from)), 1000) as unknown as number;

    return () => (
      <div>
        <span>系统已经稳定运行了</span>
        <span>{timer.label}</span>
      </div>
    );
  },
});

/** 联系方式/ICP备案 */
export const HomeFooter = defineComponent({
  // emits: ["phone"],
  setup(props, { emit }) {
    // const phone = "13046661300";
    // const phoneTouch = () => emit("phone", phone);

    return () => (
      <div class="text-center">
        <div class="flex justify-center gap-3 text-secondary mb-3">
          <a href="http://buy.qqlx.ltd" target="_blank" class="link app-buy-palette">
            蓝晶采购
          </a>
          <a href="http://sale.qqlx.ltd" target="_blank" class="link app-sale-palette">
            黑石销售
          </a>
          <a href="http://ware.qqlx.ltd" target="_blank" class="link app-ware-palette">
            琥珀库存
          </a>
          <a href="http://voucher.qqlx.ltd" target="_blank" class="link app-voucher-palette">
            翡翠财务
          </a>
        </div>
        <div class="flex justify-center gap-3 text-secondary">
          <a class="link" target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=35099902000121">
            闽公网安备35099902000121号
          </a>
          <a class="link" target="_blank" href="https://beian.miit.gov.cn/">
            闽ICP备2024037248号-1
          </a>
          <a class="link" target="_blank" href="http://qqlx.ltd">
            清泉流响软件信息有限责任公司
          </a>
        </div>
      </div>
    );
  },
});
